/*
*@date:20180902
*@author: wj 
*@description: 按YLJ的接口文档《测试接口文档.docx》，3.读取驾驶证基本信息 底层cmd：02C06
*@debug: 2018907 有应答无数据
*/

<template>
    <div class="sys-page">
        <app-title :title="dialogTitle"></app-title>
        <app-notes>通过身份证明号码读取驾驶证基本信息</app-notes>
        <el-row>
            <el-col :span="20">
                <app-search>
                    <el-form :inline="true" :model="searchForm" :rules="searchRules" ref="searchForm">
                        <el-form-item prop="sfzmhm">
                            <el-input v-model="searchForm.sfzmhm" placeholder="请输入身份证明号码"></el-input>
                        </el-form-item>
                        <el-form-item>
                            <el-button type="primary" @click="search">查询</el-button>
                        </el-form-item>
                    </el-form>
                </app-search>
            </el-col>
        </el-row>    
            <el-table v-loading="loading" border :data="tableData" :row-class-name="tableRowClassName">
                <el-table-column label="身份证明名称" width="100" prop="sfzmmc"></el-table-column>
                <el-table-column label="身份证明号码" width="180" prop="sfzmhm"></el-table-column>
                <el-table-column label="号码长度" width="50" prop="hmcd"></el-table-column>
                <el-table-column label="姓名" width="100" prop="xm"></el-table-column>
                <el-table-column label="性别" width="50" prop="xb"></el-table-column>
                <el-table-column label="出生日期" width="100" prop="csrq"></el-table-column>
                <el-table-column label="国籍" width="100" prop="gj"></el-table-column>
                <el-table-column label="登记住所行政区划" width="180" prop="djzsxzqh"></el-table-column>
                <el-table-column label="登记住所详细地址" width="180" prop="djzsxxdz"></el-table-column>
                <el-table-column label="联系电话" width="180" prop="lxdh"></el-table-column>
                <el-table-column label="档案编号" width="180" prop="dabh"></el-table-column>
                <el-table-column label="准驾车型" width="180" prop="zjcx"></el-table-column>
                <el-table-column label="累积记分" width="180" prop="ljjf"></el-table-column>





            </el-table>
            <el-alert :title="errorMsg" type="warning" :closable="false" show-icon v-show="!reliable"> </el-alert>
    </div>
</template>
<style>
  .el-table .warning-row {
    background: #F08080;
  }

  .el-table .success-row {
    background:#f0f9eb;
  }
</style>

<script>
export default {
    data(){
        return {
            safe: false,
            url: '../../trffweb/services/TmriOutAccess/queryObjectOut3.shtml',
            dialogTitle:"驾驶证基本信息查询",
            loading: false,
            tableData:[],
            errorMsg:"您的信息有误，请联系管理员修改",
            reliable:true,
            searchForm: {
                sfzmhm: '' 
            },

             searchRules: {
                sfzmhm: [
                    { required:true, message: '请输入身份证号', trigger: 'blur' },
                    {min: 18, max: 18, message: '请输入18位身份证号', trigger: 'blur'}
                ]
            }

       }
    },
    mounted(){
    },
    methods:{
        tableRowClassName({row, rowIndex}) {
          if(this.reliable === false){
            return 'warning-row';
          }else{
              return 'success-row'
          }
        },
        search(){
            this.$refs.searchForm.validate((valid)=>
            {
                if(valid){
                    this.HTTP.methods.apiPost(this.url, this.searchForm).then(res =>
                    {
                        if(res.code != 200){
                            this.$message({
                            message: res.msg,
                            type: 'error'
                            })                              
                        }else{
                            this.tableData = res.data
                            this.loading = false
                        }
                    })
                }
            })               
        }
    }
}
</script>

    
